<%@page contentType="text/html; charset=utf-8"%>
<%@page import="dao.UserDao"%>
<%@page import="dao.DaoFactory"%>
<%@page import="java.util.List"%>
<%@page import="entity.User"%>
<html>
	<head>
		<title>emplist</title>
		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="css/style.css" />
	</head>
	<body>
		<div id="wrap">
			<div id="top_content">
				<div id="header">
					<div id="rightheader">
						<p>
							2009/11/20
							<br />
						</p>
					</div>
					<div id="topheader">
						<h1 id="title">
							<a href="#">Main</a>
						</h1>
					</div>
					<div id="navigation">
					</div>
				</div>

				<div id="content">
					<p id="whereami">
					</p>
					<h1>
						Welcome!
					</h1>
					<table class="table">
						<tr class="table_header">
							<td>
								ID
							</td>
							<td>
								Username
							</td>
							<td>
								Gender
							</td>
							<td>
								Age
							</td>
							<td>

							</td>
						</tr>
						<%
							UserDao dao = DaoFactory.getInstance(UserDao.class);
							List<User> users = dao.findAll();
							if (users != null) {
								for (int i = 0; i < users.size(); i++) {
									User u= users.get(i);
						%>
						<tr class="row<%=i%2+1%>">
							<td>
								<%=u.getId() %>
							</td>
							<td>
								<%=u.getUserName() %>
							</td>
							<td>
								<%=(u.getGender()==1?"男":"女") %>
							</td>
							<td>
								<%=u.getAge() %>
							</td>
							<td>
								<a href="userDetail.jsp?id=<%=u.getId() %>">详细</a>
							</td>
						</tr>
						<%
								}
							}
						%>

					</table>
					<p>
						<input type="button" class="button" value="退出系统"
							onclick="location='logout.do'" />
					</p>
				</div>
			</div>
			<div id="footer">
				<div id="footer_bg">
					ABC@126.com
				</div>
			</div>
		</div>
	</body>
</html>
